package cn.hznc.controller.service;


import com.alibaba.fastjson.JSONObject;
import org.influxdb.dto.Point;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.influxdb.InfluxDBTemplate;
import org.springframework.stereotype.Service;


@Service
public class MqttService1 {

    @Value("${spring.mqtt.username}")
    private String username;

    @Value("${spring.mqtt.password}")
    private String password;

    @Value("${spring.mqtt.url}")
    private String hostUrl;

    @Value("${spring.mqtt.default.topic}")
    private String defaultTopic;

    //private Logger logger = LoggerFactory.getLogger(getClass());


    public void handle_message(String topic, JSONObject message) {
        if (topic.contains("Discovery/Request")) {                 //设备发现

        } else if (topic.contains("Register/Request")) {

        } else if (topic.contains("Probe/Version/Response/")) {//侦测probe文件版本号

        } else if (topic.contains("Probe/Query/Response/")) {        //获取probe文件

        } else if (topic.contains("Sample/")) {//采样数据
            String tmp[] = topic.split("/");
            if (topic.contains("sample_channel0")) {

            }
        }
    }


}